package com.neuedu.learn;

public class Demo5 {

    /**
     * 运算  逻辑运算
     * @param arg
     */
    public static void main(String arg[]){

        int age = 40;
        char gender = '女';

        System.out.println("age = " + age);
        System.out.println("gender = " + gender);

        boolean success1 =  age >= 60   && gender == '男';
        boolean success2 =  age >= 55   && gender == '女';

//        boolean result = success1 || success2;

        boolean result = (age >= 60   && gender == '男' )   ||  (age >= 55   && gender == '女');
//        System.out.println("(age > 60   && gender == '男') = " + (age > 60 && gender == '男'));
//        System.out.println("(age >= 55   && gender == '女') = " + (age >= 55 && gender == '女'));

        System.out.println("result = " + result);
        System.out.println("!result = " + !result);



        //逻辑短路
        boolean  bool1 = false;
        int numa = 10;

        System.out.println("(bool1 && ++numa>10) = " + (bool1 && ++numa > 10));

        System.out.println("numa = " + numa);



        //逻辑取反

        System.out.println("true && true = " + (true && true)); // true
        System.out.println("false && true = " + (false && true)); //false
        System.out.println("true && false = " + (true && false)); //false
        System.out.println("false && false = " + (false && false)); //false


        System.out.println("true || true = " + (true || true)); //true
        System.out.println("false || true = " + (false || true)); //true
        System.out.println("true || false = " + (true || false)); //true
        System.out.println("false || false = " + (false || false)); // false

        System.out.println("!true = " + !true);  // false
        System.out.println("!false = " + !false); //true


    }





}
